/**
 * 项目示例-列表综合搜索
 * Date 2023-8-22
 * {
 *   label: '', 筛选项名称
 *   prop: '', 筛选项字段
 *   type: '', 组件类型（'input' | 'select' | 'inputNumber' | 'cascader' | 'datePicker' | 'timePicker' | 'timeSelect' | 'treeSelect' | 'checkbox'）
 *   defaultValue: '', 筛选项默认值（不写默认undefined）
 *   inputProps: {}, 过滤组件属性，跟`ElementPlus`对应组件的`#Attributes`相同
 *   events: {} 仅支持change事件
 * }
 */
import {
  supervisionIdData,
  creatorData,
  sprojectIdData,
  terminalsData,
  gridIdsData,
} from "./options";
import type { FilterItem } from "@/components/FilterBar/types";

export const askOptions: FilterItem[] = [
  // 查询条件

  {
    // label: "项目编号:",
    label: "申报单号:",
    prop: "projectId",
    type: "select",
    span: 8,
    filterable: true,
    inputProps: {
      options: sprojectIdData,
      clearable: true,
      // placeholder: "模糊搜索",
    },
  },
  {
    label: "巡查表单:",
    prop: "supervisionId",
    type: "select",
    defaultValue: "",
    span: 8,
    inputProps: {
      options: supervisionIdData,
      clearable: true,
      // size: "large",
      // placeholder: "请选择巡查表单",
    },
  },
  {
    label: "创建人:",
    prop: "creatorId",
    type: "select",
    span: 8,
    inputProps: {
      clearable: true,
      options: creatorData,
    },
  },
  {
    label: "提交时间:",
    prop: "createTime",
    type: "datePicker",
    span: 8,
    defaultValue: [],
    inputProps: {
      type: "daterange",
      "value-format": "YYYY-MM-DD",
      "start-placeholder": "开始时间",
      "end-placeholder": "结束时间",
      "range-separator": "至",
    },
    events: {
      change: (value, evt) => {
        if (value == null) {
          evt.setFieldsValue({ createTimeStart: undefined });
          evt.setFieldsValue({ createTimeEnd: undefined });
        } else {
          evt.setFieldsValue({ createTimeStart: value[0] });
          evt.setFieldsValue({ createTimeEnd: value[1] });
        }
      },
    },
  },
  {
    label: "任务开始时间:",
    prop: "applyConstruction",
    type: "datePicker",
    span: 8,
    defaultValue: [],
    inputProps: {
      type: "daterange",
      "value-format": "YYYY-MM-DD",
      "start-placeholder": "开始时间",
      "end-placeholder": "结束时间",
      "range-separator": "至",
    },
    events: {
      change: (value, evt) => {
        if (value == null) {
          evt.setFieldsValue({ applyConstructionTimeStart: undefined });
          evt.setFieldsValue({ applyConstructionTimeEnd: undefined });
        } else {
          evt.setFieldsValue({ applyConstructionTimeStart: value[0] });
          evt.setFieldsValue({ applyConstructionTimeEnd: value[1] });
        }
      },
    },
  },
  {
    label: "任务结束时间:",
    prop: "applyEndTime",
    type: "datePicker",
    span: 8,
    defaultValue: [],
    inputProps: {
      type: "daterange",
      "value-format": "YYYY-MM-DD",
      "start-placeholder": "开始时间",
      "end-placeholder": "结束时间",
      "range-separator": "至",
    },
    events: {
      change: (value, evt) => {
        if (value == null) {
          evt.setFieldsValue({ applyEndTimeStart: undefined });
          evt.setFieldsValue({ applyEndTimeEnd: undefined });
        } else {
          evt.setFieldsValue({ applyEndTimeStart: value[0] });
          evt.setFieldsValue({ applyEndTimeEnd: value[1] });
        }
      },
    },
  },
  {
    label: "航站楼:", // 后续由接口获取下拉数据
    prop: "terminals",
    type: "checkbox",
    span: 8,
    defaultValue: [],
    inputProps: {
      // showCheckAll: true,
      options: terminalsData,
      // options: [
      //   { label: "T3航站楼", value: "24" },
      //   { label: "T5航站楼", value: "12" },
      // ],
    },
    events: {
      change: (value: any, evt: any) => {},
    },
  },
  {
    label: "网格区域:", // 后续由接口获取下拉数据
    prop: "gridIds",
    type: "checkbox",
    span: 12,
    defaultValue: [],
    inputProps: {
      // showCheckAll: true,
      options: gridIdsData,
      // options: [
      //   { label: "全部", value: "24", alert: true },
      //   { label: "分区1", value: "1" },
      //   { label: "分区2", value: "2" },
      //   { label: "分区3", value: "3" },
      //   { label: "分区4", value: "4" },
      // ],
    },
    events: {
      change: (value: any, evt: any) => {},
    },
  },
];
const getEqptFloorData = (value: any) => {
  console.log("nadO", value[0], value[1]);
};
